home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / e / misc.txt / 000105_fdc@panix.com_Mon Jul 23 14:56:29 2007.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Path: reader2.panix.com!panix!not-for-mail
  2. From: Frank da Cruz <fdc@panix.com>
  3. Newsgroups: comp.protocols.kermit.misc
  4. Subject: Re: kermit script and unix arguments
  5. Date: Mon, 23 Jul 2007 18:56:20 +0000 (UTC)
  6. Organization: PANIX Public Access Internet and UNIX, NYC
  7. Lines: 44
  8. Message-ID: <slrnfa9uek.32e.fdc@panix2.panix.com>
  9. References: <1184013722.056689.209050@r34g2000hsd.googlegroups.com> <JUyki.20761$Io4.15605@edtnps89>
  10. Reply-To: fdc@columbia.edu
  11. NNTP-Posting-Host: panix2.panix.com
  12. X-Trace: reader2.panix.com 1185216980 24951 166.84.1.2 (23 Jul 2007 18:56:20 GMT)
  13. X-Complaints-To: abuse@panix.com
  14. NNTP-Posting-Date: Mon, 23 Jul 2007 18:56:20 +0000 (UTC)
  15. User-Agent: slrn/0.9.8.0 (NetBSD)
  16. Xref: panix comp.protocols.kermit.misc:15676
  17.  
  18. On 2007-07-09, Matthew Clarke <clamat@telus.net> wrote:
  19. : mortier <mortier@locean-ipsl.upmc.fr> writes:
  20. :
  21. :>Hello,
  22. :>
  23. :>I want to use a kermit script starting with #!/usr/bin/kermit +
  24. :>with a line of argument (which can be empty). How the check if there
  25. :>are actually arguments ? In the case where there are arguement, how to
  26. :>put then in local kermit variables? In fact, how to mimic with kermit
  27. :>the linux
  28. :>while getops "options here" option ; do ... ?
  29. :>
  30. :>Thanks a lot for help, Laurent
  31. :
  32. : According to "Using C-Kermit" (2nd edition), \v(args) holds the number of
  33. : arguments and the array \&@[] holds the arguments themselves.
  34. :
  35. : See http://www.columbia.edu/kermit/scriptlib.html for example scripts,
  36. : many of which have code to parse command-line arguments.
  37. :
  38. Actually the appropriate array is \&_[] and the appropriate count is \v(argc).
  39. The \&@[] array contains *all* the command-line arguments -- command-line
  40. options for Kermit as well as arguments for the script.  When you write a
  41. kerbang script, normally you would only want the script to process the
  42. arguments that are for the script itself.  And as expected the \&_[0] element
  43. contains the name of the script, rather than the name of Kermit.  For details
  44. see:
  45.  
  46.   http://www.columbia.edu/kermit/ckermit70.html#x7.19 (kerbang scripts)
  47.  
  48. and:
  49.  
  50.   http://www.columbia.edu/kermit/ckermit70.html#x7.19 (passing arguments)
  51.  
  52. and:
  53.  
  54.   http://www.columbia.edu/kermit/ckermit70.html#x7.5 (using > 10 arguments)
  55.  
  56. Note that \&_[1] through \&_[9] are the same as \%1 through \%9 -- i.e. the
  57. regular macro / command-file arguments.  The array is useful for accessing
  58. the arguments programmatically by number, and also allows for more than 9
  59. arguments.
  60.  
  61. - Frank